package com.jzr.bedside.ui.skill

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import com.jzr.bedside.R
import com.jzr.bedside.base.BaseActivity
import com.jzr.bedside.bean.TestReportListBean
import com.jzr.bedside.presenter.contract.TestActivityContract
import com.jzr.bedside.presenter.impl.TestActivityImpl
import com.jzr.bedside.ui.adapter.FeeApadter
import com.jzr.bedside.utils.PreferUtil
import kotlinx.android.synthetic.main.actionbar_root_layout.*
import kotlinx.android.synthetic.main.activity_fee.*
import kotlinx.android.synthetic.main.activity_test.*

class TestActivity : BaseActivity(), View.OnClickListener, TestActivityContract.View {

    private val mPresnter = TestActivityImpl()

    override fun getLayoutId(): Int {
        return R.layout.activity_test
    }

    override fun attachView() {
        mPresnter.attachView(this)
    }

    override fun detachView() {
        mPresnter.detachView()
    }

    override fun initView() {
        ivRight.setOnClickListener(this)
        PreferUtil.getInstance().cureNo?.let { it ->
            mPresnter.getTestReportList(
                this@TestActivity, "admissionId",
                it
            )
        }
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.ivRight -> {
                finish()
            }
        }
    }

    override fun getTestReportListSuccess(data: TestReportListBean?) {

        if(data?.data?.size!! > 0){
//            tvDate.text =data.data?.get(0)?.risRequestDate
            tvTest.text = data.data?.get(0)?.risTestClass + data.data?.get(0)?.risTestSubClass
//            tvNumber.text = data.data?.get(0)?.risTestNumber
            tvRes.text = data.data?.get(0)?.risTestResults
            tvResDoctor.text = data.data?.get(0)?.risDoctorResults
        }

    }

    override fun showError(message: String?) {

    }

}
